<template>
  <div>
   
    <el-card class="box-card">
      <div slot="header" class="card-heaer">
        <span style="line-height: 36px;">医疗责任利益表</span>
      </div>
      <el-form label-width="150px">
        <el-row type="flex" class="row-bg">
          <!-- <el-col :span="6">
            <el-form-item label="产品名称:">
              <el-select v-model="INTEREST_ORDER_NAME" placeholder="请选择">
                <el-option v-for="item in producename" :key="item.PRODUCTNO" :label="item.PRODUCTNAME" :value="item.PRODUCTNO">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col> -->
          <el-col :span="8">
            <el-form-item label="保险金额:">
              <el-input v-model="INTEREST_ORDER_MAXMONEY" placeholder="保险金额"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="自付比例金额上限:">
              <el-input v-model="INTEREST_ORDER_ZFMAX" placeholder="自付比例金额上限"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex" class="row-bg">
          <el-col :span="6">
            <el-form-item label="免赔额单次/累计:">
              <el-radio-group v-model="INTEREST_ORDER_ISSINGLE">
                <el-radio label="单次"> 单次免赔额</el-radio>
                <el-radio label="累计"> 累计免赔额</el-radio> 
              </el-radio-group>
             
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="网络内">
              <el-input v-model="INTEREST_ORDER_MPN" placeholder="网络内"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="网络外">
              <el-input v-model="INTEREST_ORDER_MPW" placeholder="网络外"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div class="space20">
      </div>    
      <el-collapse v-if="produce.length>0">
        <el-collapse-item :title="'分项'+(index+1) " :key="index" v-for="(data, index) in produce ">
          <el-form label-width="150px" >
            <el-row type="flex" class="row-bg">
              <el-col :span="6">
                <el-form-item label="保险责任名称:">
                  <el-select v-model="data.DUTYITEM_ID" placeholder="请选择" :disabled="true">
                    <el-option v-for="item in dutyname" :key="item.DUTYITEM_ID" :label="item.DUTYITEM_NAME" :value="item.DUTYITEM_ID">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="保险金额:">
                  <el-input v-model="data.IO_DUTY_MAXMONEY" placeholder="保险金额" :disabled="true"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
          <produceliyiadd_item :id="data.DUTYITEM_ID" :index="index">
          </produceliyiadd_item>
        </el-collapse-item>
      </el-collapse>     
    </el-card>
  </div>
</template>
<script>
import {
  mapState
} from 'vuex';
import getid from '@/js/getid';
import produceliyiadd_item from '@/components/Report/userLiyi/medical_item';
export default {
  data() {
    return {
      producename: [],
      dutyname: [],
      INTEREST_ORDER_NAME: "",
      INTEREST_ORDER_MAXMONEY: "",
      INTEREST_ORDER_ZFMAX: "",
      INTEREST_ORDER_ISSINGLE: "",
      INTEREST_ORDER_MPN: "",
      INTEREST_ORDER_MPW: "",
      DUTYITEM_ID: "",
      IP_DUTY_MAXMONEY: "",
      INTEREST_ORDER_ID: ""
    };
  },
  components: {
    'produceliyiadd_item': produceliyiadd_item
  },
  computed: mapState({
    produce: state => state.produce.produce
  }),
 
  activated() {
    this.$store.commit('changer', [])
    this.$http.get("LZ_SAM_INSURPRODDEF").then(response => {
      var data = response.body;
      this.producename = data;
    }, response => {
      this.$notify.error({
        title: '网络错误',
        message: '网络错误'
      });
    });

    this.$http.get("DutyItem/0?fid=0").then(response => {
      var data = response.body;

      this.dutyname = data;
    }, response => {
      this.$notify.error({
        title: '网络错误',
        message: '网络错误'
      });

    });
    let that = this;
    this.$http.get("INTEREST_ORDER/liyi?id=" + this.$route.query["saleno"]+"&pno="+this.$route.query["pno"]).then(response => {
      var data = response.body;
      if (data.code == 1) {
        var relist = data.result[0].IP_DUTY;
        this.$store.commit('changer', data.result[0].IO_DUTY)
        this.INTEREST_ORDER_ID = data.result[0].INTEREST_ORDER_ID,
          this.INTEREST_ORDER_NAME = data.result[0].INTEREST_ORDER_NAME,
          this.INTEREST_ORDER_MPW = data.result[0].INTEREST_ORDER_MPW,
          this.INTEREST_ORDER_MPN = data.result[0].INTEREST_ORDER_MPN,
          this.INTEREST_ORDER_ISSINGLE = data.result[0].INTEREST_ORDER_ISSINGLE,
          this.INTEREST_ORDER_ZFMAX = data.result[0].INTEREST_ORDER_ZFMAX,
          this.INTEREST_ORDER_MAXMONEY = data.result[0].INTEREST_ORDER_MAXMONEY;
      }
    }, response => {
      this.$notify.error({
        title: '网络错误',
        message: '网络错误'
      });

    });

  }

}
</script>
